package com.example.ai.etl;

import org.springframework.ai.document.Document;
import org.springframework.ai.model.transformer.SummaryMetadataEnricher;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MySummaryMetadataEnricher {
    private final SummaryMetadataEnricher enricher;
    MySummaryMetadataEnricher(OpenAiChatModel aiClient) {
        this.enricher = new SummaryMetadataEnricher(aiClient,
                List.of(SummaryMetadataEnricher.SummaryType.PREVIOUS, SummaryMetadataEnricher.SummaryType.CURRENT, SummaryMetadataEnricher.SummaryType.NEXT));
    }

    public List<Document> enrichDocuments(List<Document> documents) {
        return this.enricher.apply(documents);
    }
}
